import java.io.*;

public class Tree{

	public static void main(String[] args)throws Exception {
		File views = new File("C:\\Users\\Stony1986\\Desktop\\book\\metronic\\views");
		File[] htmls = views.listFiles(new FilenameFilter(){
			public boolean accept(File file,String filename){
				return filename.endsWith(".html");
			}
		});
		FileOutputStream out = new FileOutputStream(new File("get.js"));
		for(File html : htmls){
			if(html.isFile()){
				// System.out.println(html.getName());
				String name = html.getName().replace(".html","");
				String line = "app.get(\"/"+html.getName()+"\",function(req,res){\n"+
					"\tres.render(\""+name+"\");\n"+
				"});\n";
				System.out.println(line);
				out.write(line.getBytes());
			}			
		}
		out.close();

	}
}